<?php include '_header.php' ?>

<div class="app d-flex">
    <div class="container mb-5 mx-auto">
        <h1 class="pt-5 pb-2">安装</h1>
        <ul class="steps d-flex justify-content-between list-unstyled mb-5">
            <li class="flex-fill text-muted done">
                <p>1</p>
                <p>使用协议</p>
            </li>
            <li class="flex-fill fw-bold done">
                <p>2</p>
                <p>环境检测</p>
            </li>
            <li class="flex-fill text-muted">
                <p>3</p>
                <p>写数据库</p>
            </li>
        </ul>
        <table class="table table-striped mb-4">
            <thead>
                <tr>
                    <th scope="col">环境</th>
                    <th scope="col">需要</th>
                    <th scope="col">当前</th>
                    <th scope="col">结果</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>PHP版本</td>
                    <td>^7.0</td>
                    <td><?= PHP_VERSION ?></td>
                    <td><?= $php_version ? '<span class="text-success">通过</span>' : '<span class="text-danger">未通过</span>' ?></td>
                </tr>
            </tbody>
        </table>

        <table class="table table-striped mb-4">
            <thead>
                <tr>
                    <th scope="col" colspan="2">目录权限检测</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($write as $k => $v) : ?>
                    <?php if(!$v) {$succeed = 0;} ?>
                    <tr>
                        <td><?= $k ?></td>
                        <td class="text-center"><?= $v ? '<span class="text-success">可写</span>' : '<span class="text-danger">不可写</span>' ?></td>
                    </tr>
                <?php endforeach ?>
            </tbody>
        </table>
        <div class="text-center">
            <?php if($php_version && $succeed): ?>
                <a href="/install/last" class="btn btn-secondary rounded-pill">下一步</a>
            <?php else: ?>
                <a href="javascript:;" class="btn btn-danger rounded-pill disabled" disabled>检测未通过</a>
            <?php endif ?>
            <a href="/install/" class="btn btn-light rounded-pill">上一步</a>
        </div>
    </div>
</div>

<?php include '_footer.php' ?>